<template>
    <div>
        <table class="table">
            <tbody>
                <tr>
                    <td>名称</td>
                    <td>
                        <input type="text" v-model="date.insenName">
                    </td>
                </tr>
                <tr>
                    <td>人数</td>
                    <td>
                        <input type="text" v-model="date.preame">
                    </td>
                </tr>
                <tr>
                    <td>描述</td>
                    <td>
                        <textarea v-model="date.miaoshu"></textarea>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td colspan="2">
                        <input type="button" value="新增" @click="add">
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { useRouter } from 'vue-router';
import axios from 'axios';
const routher = useRouter();
const add=()=>{
    axios.post("https://localhost:7223/api/Insen/AddInsen",date.value).then(res=>{
        if(res.data>0){
            alert("新增成功")
            routher.push({path:"/Show"})
        }
        else{
            alert("新增是比")
        }
    })
}
const date=ref({
  "insenId": 0,
  "insenName": "",
  "preame": 0,
  "miaoshu": "",
  //"creates": "2025-05-01T06:56:51.368Z",
  //"isDelete": false
})
</script>

<style scoped>

</style>